package zhao.tx.eecs;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Application;
import android.content.Context;

import java.util.LinkedList;
import java.util.List;

/**
 * Created by ishishuji on 14/11/27.
 */
public class MyApplication extends Application {

    private static MyApplication _instance;

    public static MyApplication getInstance () {
        return _instance;
    }

    private List<Activity > activityList = new LinkedList<Activity> ();


    public void addActivity(Activity activity) {
        activityList.add(activity);
    }

    public void resumeActivityList (  ) {
        activityList.clear ();
    }

    public void finishAllSub() {

        for (Activity activity : activityList) {
            activity.finish();
        }

        resumeActivityList ();

    }


    @Override
    public void onCreate () {
        super.onCreate ();
        _instance = this;
        init ( this );
    }

    @SuppressLint ( "NewApi" )
    private void init ( Context context ) {
        MyVolley.init ( this );
    }

}
